<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .con {
            width: 500px;
            height: 500px;
            border: 1px solid #000;
            position: relative;
        }

        .box1 {
            width: 100px;
            height: 100px;
            background-color: gold;
            position: absolute;
            left: 0;
            top: 50px;
            transition: all  2s ease;
        }
        .box2 {
            width: 100px;
            height: 100px;
            position: absolute;
            background-color: red;
            left: 0;
            bottom: 50px;
            transition: all  2s linear;
        }

        .con:hover .box1{
            left: 400px;
        }
        .con:hover .box2{
            left: 400px;
        }
    </style>
</head>

<body>


    <div class="con">
        <div class="box1"></div>
        <div class="box2"></div>

    </div>


</body>

</html>